package com.example.cstvdemoone.adapters;

import java.util.ArrayList;

import com.example.cstvdemoone.data.AutoRecommendModel;

import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class AutoRecommendAdapter extends PagerAdapter {
	private ArrayList<ImageView> imageViews;
	private ArrayList<AutoRecommendModel> recommendModels;
	
	
	
	public AutoRecommendAdapter(){
		imageViews = new ArrayList<ImageView>();
		recommendModels = new ArrayList<AutoRecommendModel>();
	}
	
	
	
	public void addImageviews(ArrayList<ImageView> imageViewsTemp){
		imageViews.addAll(imageViewsTemp);
	}
	
	public void clearImageViews(){
		imageViews.clear();
	}
	
	public ArrayList<ImageView> getImageViews(){
		return imageViews;
	}
	
	@Override
	public int getCount() {
		return imageViews == null?0:imageViews.size();
	}

	@Override
	public Object instantiateItem(View arg0, int arg1) {
		((ViewPager) arg0).addView(imageViews.get(arg1));
		return imageViews.get(arg1);
	}

	@Override
	public void destroyItem(View arg0, int arg1, Object arg2) {
		((ViewPager) arg0).removeView((View) arg2);
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void restoreState(Parcelable arg0, ClassLoader arg1) {

	}

	@Override
	public Parcelable saveState() {
		return null;
	}

	@Override
	public void startUpdate(View arg0) {

	}

	@Override
	public void finishUpdate(View arg0) {

	}
}
